from selenium import webdriver
from time import sleep
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains

# 打开浏览器
driver = webdriver.Firefox()
# 双击打开百度页面
driver.get('https://www.jiuxian.com/')
sleep(2)
# 窗口最大化
driver.maximize_window()
sleep(2)
# 点击请登录
driver.find_element(By.CLASS_NAME, 'headerLogin').click()
sleep(2)
# 点击qq登录小图片
# driver.find_element(By.XPATH, '//*[@id="loginform"]/div/div/div/div/div[1]/div[4]/div/a[1]/i').click()
driver.find_element(By.XPATH, '/html/body/div[1]/form/div/div/div/div/div[1]/div[4]/div/a[1]/i').click()
sleep(2)
# 进入frame框架
f = driver.find_element(By.NAME, 'ptlogin_iframe')
driver.switch_to.frame(f)
sleep(2)
# 点击图片登录
# driver.find_element(By.ID, 'img_out_2318636512').click()
# 点击密码登录
driver.find_element(By.ID, 'switcher_plogin').click()
sleep(2)
# 输入账号
driver.find_element(By.ID, 'u').send_keys('2318636512')
sleep(1)
# 输入密码
driver.find_element(By.ID, 'p').send_keys('123456')
sleep(2)
# 点击登录
driver.find_element(By.ID, 'login_button').click()



sleep(10)








